﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Log4NetLibrary;

namespace MeterWindowsService
{
    public partial class MeterPoolService : ServiceBase
    {
        ILogService logService;

        public MeterPoolService()
        {
            try
            {

                log4net.Config.XmlConfigurator.Configure();
                logService = new FileLogService(typeof(MeterPoolService));
                InitializeComponent();
            }

            catch (Exception ex)
            {
                logService.Error(ex.Message);
            }
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                MeterService.Helpers.FileWatcher _watcher = new MeterService.Helpers.FileWatcher();
                _watcher.Intialize();
                logService.Info("Meter Pool Service Started");
            }

            catch (Exception ex)
            {
                logService.Error(ex.Message);
            }
        }

        protected override void OnStop()
        {
        }
    }
}
